/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.system;

import com.enation.app.javashop.core.client.feignimpl.system.PageDataClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.pagedata.PageData;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 楼层相关熔断
 *
 * @author zh
 * @version v7.0
 * @date 18/9/27 下午3:44
 * @since v7.0
 */
@Component
public class PageDataClientFallbackFactory extends BaseFallbackFactory< PageDataClientFeignImpl> implements FallbackFactory {

    @Override
    protected PageDataClientFeignImpl fallback() {
        return new PageDataClientFallback();
    }

    /**
     * 楼层相关熔断
     *
     * @author zh
     * @version v7.0
     * @date 18/9/27 下午3:44
     * @since v7.0
     */
    @Component
    public static class PageDataClientFallback implements PageDataClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public PageData edit(PageData page, Long id) {
            logger.error("修改楼层相关数据失败");
            return null;
        }

        @Override
        public List<PageData> selectPageByGoods(Long[] goodsIds) {
            logger.error("查询某些商品的微页面失败");
            return new ArrayList<>();
        }
    }
}
